﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<OurSite.Web.Models.EventsModel> " %>
<%@ Import Namespace="OurSite.Business.Video"%>
<%@ Import Namespace="OurSite.Business.Event"%>
<%@ Import Namespace="OurSite.Web.HTMLHelpers" %>    
          <!-- Level 1 Control-->
<section id="level1">				
    <header> 
        <div class="galleryHeader">
	        <h1><%= Html.Encode(ViewData["SectionTitle"])%></h1> 
	    </div>
    </header> 
    <article> 
   	        <%foreach (Event evt in Model.Events) 
            { %>
   	            <div class="gallery-outeritem">
   	                <div class="gallery-inneritem">
   	                    <div class="galleryThumb galleryThumbImage">
   	                        <i style="background-image: url('<%= Model.Prefix + "Small" + evt.ListingPicture.ImagePath%>')"></i>
   	                        <%= evt.Name %>
   	                    </div>
   	                  	
   	                  	<div class="margin-left-10 alignleft"><b><%= evt.Name %></b></div>
   	                  	<br/>
   	                  	
   	                  	<% int counter = 0;
                        int supercounter = 1;
                        
   	                    foreach (Event subEvent in evt.SubEvents) 
                        { %>
   	                        <% if (counter == 0) 
                            { %>    
   	                            <div class="gallery-item">
   	                        <%} %> 
   	                               
                           <a href="/photos.aspx/<%= Model.URLPath + "/" + subEvent.URLFriendly %>" title="<b><%=subEvent.FullLocation %>"></b><br /><%=subEvent.Name%></a><br />
                           <% counter++;
                            bool closeFlag = false;
                              if (counter == Model.numberToGroup) 
                            {
                                counter = 0;
                                closeFlag = true;%>
                                </div> 
                          <%} %>
                              
                              
                          <%
                            if ((supercounter == evt.SubEvents.Count) && (!closeFlag)) {%>
                                </div> 
                          <%} supercounter++;%>
                        <%} %>

   	                    <div class="clear"></div>
   	                </div>
   	                
                </div>
    	<%  } %>
    	
    </article>
</section>
    
<% Html.RenderAction("PhotoMenu", "Photos"); %>

<div class="clear"></div>